<template>
  <!--  <div><h1>{{ sessionName }}</h1></div>-->
  <!--  <el-divider border-style="dotted" />-->
  <el-breadcrumb separator=">">
    <el-breadcrumb-item :to="{ path: '/' }">任务列表</el-breadcrumb-item>
    <el-breadcrumb-item>{{ sessionName }}</el-breadcrumb-item>
  </el-breadcrumb>
  <div style="height: 10px"></div>
  <el-tabs type="border-card" class="demo-tabs" v-if="sessionToken!==''">
    <el-tab-pane label="日志">
      <sessionLogManage :sessionToken="sessionToken"></sessionLogManage>
    </el-tab-pane>
    <el-tab-pane label="操作页面">
      <sessionFunctionChoice :sessionToken="sessionToken"></sessionFunctionChoice>
    </el-tab-pane>
    <el-tab-pane label="SPEC对比" :disabled="!isTabShow_spec">
      <sessionSpecManage :sessionToken="sessionToken"></sessionSpecManage>
    </el-tab-pane>
    <el-tab-pane label="文件管理">
      <sessionFileManage :sessionToken="sessionToken"></sessionFileManage>
    </el-tab-pane>
    <el-tab-pane label="快捷粘贴">
      <sessionEasyManage :sessionToken="sessionToken"></sessionEasyManage>
    </el-tab-pane>
    <el-tab-pane label="文本编辑">
      <sessionEditManage :sessionToken="sessionToken"></sessionEditManage>
    </el-tab-pane>
    <el-tab-pane label="Task">
      <sessionTaskManage :sessionToken="sessionToken"></sessionTaskManage>
    </el-tab-pane>
  </el-tabs>
  <el-divider border-style="dotted"/>
</template>

<script>
// import kojiPatternList from "@/components/kojiPatternList";
import axios from 'axios'
import sessionSpecManage from "@/components/sessionSpecManage";
import sessionTaskManage from "@/components/sessionTaskManage";
import sessionFunctionChoice from "@/components/sessionFunctionChoice";
import sessionFileManage from "@/components/sessionFileManage";
import sessionLogManage from "@/components/sessionLogManage";
import sessionEasyManage from "@/components/windowEasyManage";
import sessionEditManage from "@/components/sessionEditManage";
import getPara from "@/utils/get_para_by_url"


export default {

  name: "viewSessionPage",
  components: {
    // kojiPatternList,
    sessionLogManage,
    sessionTaskManage,
    sessionFunctionChoice,
    sessionFileManage,
    sessionSpecManage,
    sessionEasyManage,
    sessionEditManage
  },
  data() {
    return {
      isSessionCreated: false,
      sessionName: "当前会话",
      sessionToken: "",
      sessionMsgTag: "",
      codeName: '',
      sessionMsgList: [],
      isTabShow_spec: true
    }
  },
  methods: {
    get_session_token() {  // 获取一个sessionToken
      let obj_this = this
      let data = {"session_function": "session_init"}
      obj_this.sessionToken = getPara.getQueryString("sessionToken") || getPara.getHashString("sessionToken")
      if (obj_this.sessionToken !== "") {
        obj_this.isSessionCreated = true;
        return
      }
      axios.post('/session_function_do', data).then(function (response) {
        obj_this.sessionToken = response.data.session_token
        window.location.hash = "sessionToken=" + response.data.session_token
      }).catch(function (error) { // 请求失败处理
        console.log(error);
      });
    },

  },
  mounted() {
  },
  created() {
    this.get_session_token()
  }
}
</script>
<style scoped></style>